home *** CD-ROM | disk | FTP | other *** search
/ The Very Best of Atari Inside / The Very Best of Atari Inside 1.iso / mint / mntlib43 / mntlib / cuserid.c < prev    next >
C/C++ Source or Header  |  1993-06-26  |  466b  |  30 lines

  1. /* ctermid() emulation by entropy@terminator.rs.itd.umich.edu
  2.    Public domain.
  3.    DO NOT USE THIS FUNCTION!
  4.    It is provided for System V compatibility only.
  5. */
  6.  
  7. #define _SYSV_SOURCE
  8.  
  9. #include <stdio.h>
  10. #include <string.h>
  11. #include <unistd.h>
  12.  
  13. char *
  14. cuserid(s)
  15.   char *s;
  16. {
  17.   static char name[L_cuserid];
  18.   char *t;
  19.  
  20.   if (!s)
  21.     s = name;
  22.   t = getlogin();
  23.   if (t)
  24.     strncpy(s, t, L_cuserid);
  25.   else
  26.     s[0] = '\0';
  27.   s[L_cuserid - 1] = '\0';
  28.   return s;
  29. }
  30.